Skip to content

fix: Clear initialPrompt on first agent event to preserve history on retry#1580

Merged
charlesvien merged 1 commit intomainfrom
04-08-clear_initialprompt_on_first_agent_event_to_preserve_history_on_retry
Apr 9, 2026
Merged

fix: Clear initialPrompt on first agent event to preserve history on retry#1580
charlesvien merged 1 commit intomainfrom
04-08-clear_initialprompt_on_first_agent_event_to_preserve_history_on_retry

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented Apr 9, 2026

Problem

Retry after mid-turn disconnection discards conversation history and starts a fresh session, even when the agent completed significant work.

Closes #1518

Changes

  1. Clear initialPrompt in handleSessionEvent when the first non-prompt-echo event arrives
  2. This makes clearSessionError take the reconnectInPlace path instead of createNewLocalSession
  3. Add test for clearSessionError when initialPrompt is set

How did you test this?

Manually

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title Clear initialPrompt on first agent event to preserve history on retry fix: Clear initialPrompt on first agent event to preserve history on retry Apr 9, 2026
@charlesvien charlesvien marked this pull request as ready for review April 9, 2026 05:05
@charlesvien charlesvien merged commit 1f73cb4 into main Apr 9, 2026
16 checks passed
@charlesvien charlesvien deleted the 04-08-clear_initialprompt_on_first_agent_event_to_preserve_history_on_retry branch April 9, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversation history sometimes lost after agent/session reconnect

2 participants